<html>

<head>
<title>The kernel adventure</title>
</head>

<body>
<center> <h1>The non recursive makefile</h1>
<img border="0" src="pictures/kernel.jpg" width="75" height="75"><br></center>

<h2> The idea </h2>
<p>
The first idea is to have only one make call which will compute everything directly. The second idea is
to have a structured and simple view of the projects with modules. Each modules can be considered as independent blocks of code that could be compiled
in stand alone.
<br>
Those ideas are achieved by having a unique makefile (makefile) as the root of the build structure. This makefile lists
all the modules which have to be included in the build.
In the same way, each modules contains a makefile (module.mak) which lists the sources to be compiled in that module.
<br>
When building, the root makefile will open all the module makefiles according to its module list and create an exhaustive list of all the sources to compile.
<br>
A rule makefile (rules.mak) is also used for the compiler, linker or assembler commands. The root makefile, by including these rules,
will then execute the proper commands for each file.
Makefile and module.mak are then kept very simple (just a list of what to compile and build).
</p>

<p>
<b>The root makefile</b><br><br>
<img border="0" src="pictures/RootMak.gif" width="800"><br><br>
<b>The module makefile</b><br><br>
<img border="0" src="pictures/ModuleMak.gif" width="800"><br><br>
<b>The rules makefile</b><br><br>
<img border="0" src="pictures/RulesMak.gif" width="800"><br><br>
</p>

<h2> The advantages </h2>
<p>
The fact that the root makefile and the module makefiles are simple list of elements enables the developper to keep a simple view of the project:
no need to remember the complete project picture in order to understand.
For instance, the developper can move the module at any place. The only change required is then inside the module list of the root makefile.
In the same way, when coding, the developper can only focus on the module he is developping, filling the file list in that module makefile only.
<br>
The non recursivity allows a better dependency management. The dependencies are created only once and based on the generated and exhaustive list of sources.
It then fully uses the possibilities of the dependency tools (ex: makedepend), and finally keep coherent the dependencies.
It also fasten the build.
</p>


<h2> The critics </h2>
<p>
The main critic we can hear against it is the memory consumption of that system. Managing all the files at once can become painfull with a very large project.
But, with the constant improvement of the computer performances, ths critic becomes less and less an argument. The futur will tell us!
</p>


<HR>
<center> Copyright@ Luc Fourestier 2007 : lfourestier@yahoo.fr </center> <br>
</body>
</html>
